package com.wei.czz.common.dto.annex;

import com.wei.czz.common.vo.annex.AnnexConfigFieldVo;
import com.wei.czz.framework.annex.entity.AnnexGroupEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2024-03-29 11:05:09
 * className: AnnexGroupViewDto
 * version: 1.0
 * description:
 */
@Getter
@Setter
@Accessors(chain = true)
public class AnnexGroupViewDto extends AnnexGroupDto {

    /**
     * 附件字段列表
     */
    private List<AnnexConfigFieldVo> fieldList;

    /**
     * 附件动态配置分组映射
     * @param annexGroup 附件动态配置分组对象
     * @return 映射结果
     */
    public static AnnexGroupViewDto map(AnnexGroupEntity annexGroup) {
        AnnexGroupViewDto annexGroupViewDto = new AnnexGroupViewDto();
        annexGroupViewDto.setId(annexGroup.getId().toString());
        annexGroupViewDto.setParentId(annexGroup.getParentId().toString());
        annexGroupViewDto.setPreId(annexGroup.getPreId().toString());
        annexGroupViewDto.setName(annexGroup.getName());
        annexGroupViewDto.setSort(annexGroup.getSort());
        return annexGroupViewDto;
    }
}
